#include <time.h>
#include <stdio.h>
#include <stdlib.h>

long time_mtime;
clock_t time_start;
clock_t time_end;
long time_seconds;
long time_useconds;
/*
  return time #include struct tm format.
 */

void GetStartTime()
{
  time_start = clock(); 
}

void GetEndTime()
{
  time_end = clock();
}

double Interval()
{
  return (double)(time_end - time_start)/(double)CLOCKS_PER_SEC;
}

struct tm *getcurrentTime()
{
  time_t *t = (time_t *)malloc(sizeof(time_t));
  struct tm *tminfo;
  time(t);
  tminfo =  localtime(t);
  return tminfo;
}

struct tm *createNewTime(int year,int month,int day,int hour,int minute,int second)
{
  struct tm *t = (struct tm *)malloc(sizeof(struct tm));
  t->tm_year = year - 1900;
  t->tm_mon = month;
  t->tm_mday = day;
  t->tm_hour = hour;
  t->tm_min = minute;
  t->tm_sec = second;
  t->tm_isdst = 0;
  return t;
}

void sscanfTest()
{
   int day, year;
   char weekday[20], month[20], dtm[100];

   strcpy( dtm, "Saturday March 25 1989" );
   sscanf( dtm, "%s %s %d  %d", weekday, month, &day, &year );

   printf("%s %d, %d = %s\n", month, day, year, weekday );
}
